package com.lk.oauth2.server.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.lk.oauth2.web.entity.SysUser;
import com.lk.oauth2.web.service.SysUserService;

/**
 * @description:
 * @author: Li Kang
 * @create: 2020-08-30 16:03
 */
@Component("customUserDetailsService")
public class CustomUserDetailsService extends AbstractUserDetailsService {
  private static final Logger logger = LoggerFactory.getLogger(CustomUserDetailsService.class);
  @Autowired private SysUserService sysUserService;

  @Override
  public SysUser findSysUser(String usernameOrMobile) {
    logger.info("请求认证的用户名：" + usernameOrMobile);
    return sysUserService.findByUsername(usernameOrMobile);
  }
}
